<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>系统首页</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" >
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <link href="${g_path}/css/font-awesome-4.7.0/css/font-awesome.min.css"
	rel="stylesheet" type="text/css">
    <script src="${g_path}/js/sys/common.js" type="text/javascript"></script>
	<script src="${g_path}/js/sys/inner/pwdcheckpolicy.js" type="text/javascript"></script>
	
	<style type="text/css">
	body,html {
		width: 100%;
		height: 100%;
		padding: 0px;
		margin: 0px;
		overflow: hidden;
	}
    .zt01 {
        font-family: "宋体";
        font-size: 13px;
        font-style: normal;
        line-height: 25px;
        font-weight: bold;
        font-variant: normal;
        color: #FFFFFF;
    }
    .header{
    	background-color : #2254a1;
    }
    </style>
</head>
<body>
    
<!--Layout-->
	<div id="layout1" class="mini-layout" style="width:100%;height:100%;">
	    <div class="header" region="north" height="50" showSplit="false" showHeader="false" splitSize="0" style=" border: 0;">
	        <table width="100%" height="50"  border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <h1 style="margin:0;padding:3px 15px; padding-left: 30px; cursor:default;font-family:微软雅黑,黑体,宋体; color: white;">
                        LP快速开发框架1
                        </h1>
                    </td>
                    <td width="520">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                            	<td>&nbsp;</td>
                                <td width="21">
                                    </td>
                                <td width="10">&nbsp;</td>
                             	<!-- 
								<td width="70" class="zt01"><span onclick="setSession()" style="cursor: pointer;"><i class="fa fa-home fa-lg"></i>测试设置会话</span></td>
                                <td width="70" class="zt01"><span onclick="getSession()" style="cursor: pointer;"><i class="fa fa-home fa-lg"></i>测试获取会话</span></td>
                                 -->
                                <td width="90" class="zt01"><i class="fa fa-user fa-lg"></i> ${g_user.username}</td>
                                <td width="70" class="zt01"><span onclick="onShowWaitDoClick()" style="cursor: pointer;"><i class="fa fa-home fa-lg"></i>首页</span></td>
                                <td width="90"><span class="zt01" onclick="onShowChangePwdWin()" style="cursor: pointer;"><i class="fa fa-lock fa-lg"></i>修改密码</span></td>
                                <td width="90"><span class="zt01" onclick="onCloseClick()" style="cursor: pointer;"><i class="fa fa-power-off fa-lg"></i>重新登录</span></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
	    </div>
	    <div title="center" region="center" style="border:0;" bodyStyle="overflow:hidden;">
	        <!--Splitter-->
	        <div class="mini-splitter" style="width:100%;height:100%;" borderStyle="border:0;">
	            <div size="180" maxSize="250" minSize="100" showCollapseButton="true" style="border-width:1px;">
	                <div id="leftTree" class="mini-outlooktree" url="getOutLookTree" onnodeclick="onNodeSelect"
	                    textField="text" idField="id" parentField="pid">
	                </div>
	            </div>
	            <div showCollapseButton="false" style="border:0;">
	                <div id="mainTabs" class="mini-tabs" activeIndex="0" style="width:100%;height:100%;"      
	                     plain="false" onactivechanged="onTabsActiveChanged" contextMenu="#tabsMenu">
	                    <div name="first" title="首页" url="">
	                    </div>
	                </div>
	            </div>        
	        </div>
	    </div>
	</div>

    <div id="winPassword" class="mini-window" title="修改密码" style="width:350px;height:210px;" 
	    showMaxButton="false" showCollapseButton="false" showShadow="true"
	    showToolbar="false" showFooter="true" showModal="true" allowResize="false" allowDrag="true"
	    >
	    <div property="footer" style="text-align:right;padding:8px;padding-right:60px;">
	        <a class="mini-button" iconCls="icon-ok" onclick="onChangePwdWinOkClick">修改密码</a>
	        &nbsp;&nbsp;<a class="mini-button" iconCls="icon-cancel" onclick="onChangePwdWinCancelClick">取消</a>
	    </div>
	    <div style="padding: 10px 0px;">
	    	<table border="0" cellpadding="1" cellspacing="2" style="width:100%; font-size: 13px;">
			    <tr>
			        <td style="width:30%; text-align: right;">原&nbsp;密&nbsp;码：</td>
			        <td style="width:70%">
			            <input name="cp_old" id="cp_old" class="mini-password" required="true" style="width:80%" />
			        </td>
			    </tr>
			    <tr>
			        <td style="text-align: right;">新&nbsp;密&nbsp;码：</td>
			        <td >
			            <input name="cp_new1" id="cp_new1" class="mini-password" required="true" style="width:80%"  />
			        </td>
			    </tr>
			    <tr>
			        <td style="text-align: right;">确认密码：</td>
			        <td >
			            <input name="cp_new2" id="cp_new2" class="mini-password" required="true" onvalidation="onNewPwdValidation" style="width:80%"  />
			        </td>
			    </tr>
			</table>
	    </div>
	</div>

	<ul id="tabsMenu" class="mini-contextmenu" onbeforeopen="onBeforeOpen">        
        <li onclick="closeTab">关闭标签页</li>                
	    <li onclick="closeAllBut">关闭其他标签页</li>
	    <li onclick="closeAll">关闭所有标签页</li>        
        <li onclick="closeAllButFirst">关闭其他[首页除外]</li>   
    </ul>
    
    
    <script type="text/javascript">
        mini.parse();
		
        var tree = mini.get("leftTree");
		var tabs = mini.get("mainTabs");
        var currentTab = null;

        function onBeforeOpen(e) {
            currentTab = tabs.getTabByEvent(e.htmlEvent);
            if (!currentTab) {
                e.cancel = true;                
            }
        }

        ///////////////////////////
        function closeTab() {
            tabs.removeTab(currentTab);
        }
        function closeAllBut() {
            tabs.removeAll(currentTab);
        }
        function closeAll() {
            tabs.removeAll();
        }
        function closeAllButFirst() {
            var but = [currentTab];            
            but.push(tabs.getTab("first"));
            tabs.removeAll(but);
        }
        
        
        function showTab(node) {
            var mtabs = mini.get("mainTabs");

            var id = "tab$" + node.id;
            var tab = mtabs.getTab(id);
            if (!tab) {
                tab = {};
                tab._nodeid = node.id;
                tab.name = id;
                tab.title = node.text;
                tab.showCloseButton = true;
                //这里拼接了url，实际项目，应该从后台直接获得完整的url地址
                //tab.url = mini_JSPath + "../../../app/sys/" + node.id + ".html";
                tab.url="${g_path}"+node.url;
                mtabs.addTab(tab);
            }
            mtabs.activeTab(tab);
        }

        function onNodeSelect(e) {
            var node = e.node;
            var isLeaf = e.isLeaf;

            if (isLeaf) {
                showTab(node);
            }
        }

        function onClick(e) {
            var text = this.getText();
            alert(text);
        }
        function onQuickClick(e) {
            tree.expandPath("datagrid");
            tree.selectNode("datagrid");
        }

        function onTabsActiveChanged(e) {
            var tabs = e.sender;
            var tab = tabs.getActiveTab();
            if (tab && tab._nodeid) {
                
                var node = tree.getNode(tab._nodeid);
                if (node && !tree.isSelectedNode(node)) {
                    tree.selectNode(node);
                }
            }
        }
        
        function onShowChangePwdWin() {
			var win = mini.get("winPassword");
			win.showAtPos("center", "middle");
			$("#winPassword input").val("");
			mini.get("cp_old").focus();
		}
		
		function onNewPwdValidation(e){
			if (e.isValid) {
				var newPassword = mini.get("cp_new1").getValue();
				var newPassword2 = mini.get("cp_new2").getValue();
			
                if (newPassword != newPassword2) {
                    e.errorText = "确认密码不一致";
                    e.isValid = false;
                }
            }
		}
		
		function onChangePwdWinOkClick() {
			var oldPassword = mini.get("cp_old").getValue();
			var newPassword = mini.get("cp_new1").getValue();
			var newPassword2 = mini.get("cp_new2").getValue();
			
			if( oldPassword=="" || newPassword =="" || newPassword2 == ""  ){
				MsgBox.alert("原密码、新密码、确认密码不能为空，请填写！");	
	            return ;
			}
			
			if (newPassword != newPassword2) {
            	MsgBox.alert("新密码和确认密码不一致！");	
                return ;
	        }
             
            var chkResult = lpCheckPwd(newPassword);
            if(chkResult){
            	MsgBox.alert("新密码" + chkResult + "！");	
            	return;
			}
			
			var arg = {
				pwd1: lpPwdMd5(oldPassword),
				pwd2: lpPwdMd5(newPassword)
			}
			
			getJson("dorestpwd?",arg, true, function(re){
				if(re.isOk){
					mini.get("winPassword").hide();
	            	MsgBox.alert("密码修改成功！");		            
	            }
	            else{
	            	MsgBox.alert(re.msg);
	            }
			});
			
		}
		
		function onChangePwdWinCancelClick(){
			mini.get("winPassword").hide();
		}
		
		function onCloseClick(){
			getJson("dologout?",null, false, function(re){
				window.location = "login";
			});
		}
		
		function showTabs(id, title) {
			var tab = tabs.getTab(title);
			if (tab) {
				tabs.activeTab(tab);//选中标签页
			} else {
				var tab = {};
				tab.name = title;
				tab.title = title;
				tab.showCloseButton = true;//是否显示关闭按钮
				tab.url = "${g_path}/indexPanel/showIndexGg?bbs_no=" + id;
				
				tabs.addTab(tab);//添加标签页
				tabs.activeTab(tab);//选中标签页
			}
		}
		
		//点击首页按钮要做的事
		function onShowWaitDoClick() {
			var tab = tabs.getTab('first');
			if (tab) {
				tabs.activeTab(tab);//选中标签页
				tabs.reloadTab(tab);
			} else {
				var tab = {};
				tab.name = "first";
				tab.title = "首页";
				tab.showCloseButton = false;//是否显示关闭按钮
				tab.url = ""
				tabs.addTab(tab);//添加标签页
				tabs.activeTab(tab);//选中标签页
			}
			
		}
		
		function setSession(){
			var url = "${g_path}/setSessionTest";
			getJson(url,null,true,function(data){
				MsgBox.showInfoTips("设置Session，svr:" +data.service + "，session:"+data.data);
			});
		}
		
		function getSession(){
			var url = "${g_path}/getSessionTest";
			getJson(url,null,true,function(data){
				MsgBox.showInfoTips("获取Session，svr:" +data.service + "，session:"+data.data);
			});
		}
    </script>

</body>
</html>